import request from '@/utils/request'

// 查询产品入库单列表
export function listProduct_receipt(query) {
  return request({
    url: '/yyj/wm/inbound/product_receipt/list',
    method: 'get',
    params: query
  })
}

// 查询产品入库单详细
export function getProduct_receipt(prCode) {
  return request({
    url: '/yyj/wm/inbound/product_receipt/' + prCode,
    method: 'get'
  })
}

// 新增产品入库单
export function addProduct_receipt(data) {
  return request({
    url: '/yyj/wm/inbound/product_receipt',
    method: 'post',
    data: data
  })
}

// 修改产品入库单
export function updateProduct_receipt(data) {
  return request({
    url: '/yyj/wm/inbound/product_receipt',
    method: 'put',
    data: data
  })
}

// 产品入库
export function storeProduct_receipt(data) {
  return request({
    url: '/yyj/wm/inbound/product_receipt/store',
    method: 'put',
    data: data
  })
}

// 删除产品入库单
export function delProduct_receipt(prCode) {
  return request({
    url: '/yyj/wm/inbound/product_receipt/' + prCode,
    method: 'delete'
  })
}

// 查询产品编码
export function getPdCode(isMaterial) {
  return request({
    url: '/yyj/wm/info/product/list/code/' + isMaterial,
    method: 'get'
  })
}

// 查询仓库编码
export function getWCode(query) {
  return request({
    url: '/yyj/wm/warehouse/manage/list/codes',
    method: 'get',
    params: query
  })
}

// 查询库区编码
export function getSaCode(query) {
  return request({
    url: '/yyj/wm/warehouse/area/list/codes',
    method: 'get',
    params: query
  })
}

// 查询库位编码
export function getSlCode(query) {
  return request({
    url: '/yyj/wm/warehouse/location/list/codes',
    methods: 'get',
    params: query,
  })
}

// 查询批次号
export function getBatch(queryBatch) {
  if (queryBatch === undefined) {
    return request({
      url: '/yyj/wm/inbound/product_receipt/list/batch/',
      method: 'get'
    })
  } else {
    return request({
      url: '/yyj/wm/inbound/product_receipt/list/batch/' + queryBatch,
      method: 'get'
    })
  }
}

// 查询生产工单
export function getWorkOrder(query) {
  return request({
    url: '/yyj/wm/inbound/product_receipt/order/list',
    method: 'get',
    params: query
  })
}

